package com.yingxin.yxerp.module.attachment.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.yingxin.yx.framework.commons.dto.AttachmentDto;
import com.yingxin.yx.framework.commons.enums.BusinessType;
import com.yingxin.yxerp.module.attachment.entity.Attachment;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * 附件表 服务类
 * @author zhuchangjie
 * @since 2022-01-23
 */

public interface IAttachmentService extends IService<Attachment> {

    /**
     * 上传
     */
    Attachment upload(MultipartFile file, String name, String bizId, String bizType, String bizAttr);

    /**
     * 多个上传
     */
    List<Attachment> uploadBatch(List<MultipartFile> files, String bizId, String bizType, String bizAttr);

    /**
     * 查询一个 by biz
     */
    AttachmentDto getByBiz(String bizId, BusinessType bizType, String bizAttr);

    /**
     * 查询多个 by biz
     */
    List<AttachmentDto> listByBiz(String bizId, String bizType);

    List<AttachmentDto> listByBiz(String bizId, BusinessType bizType);

    List<AttachmentDto> listByBiz(String bizId, BusinessType bizType, String bizAttr);

    /**
     * 更新 by biz
     */
    void addInfo(String bizId, BusinessType bizType, String bizAttr, AttachmentDto attachment, Boolean fullUpdate);

    void addInfo(String bizId, BusinessType bizType, String bizAttr, List<AttachmentDto> attachmentList, Boolean fullUpdate);

    void deleteByBiz(String bizId, BusinessType bizType, String bizAttr);

    void copy(String bizId, BusinessType bizType, String bizAttr, String attachmentId);

    /**
     * 根据 ids 获取集合
     */
    List<AttachmentDto> myListByIds(List<String> ids);

}
